package com.licode.utils.unilite.dp;

import lombok.Getter;

import java.util.List;

/**
 * 分页查询基类
 *
 * @author WR
 * @since 2016/7/9 15:55
 */
@Getter
public class PageResult<T> {
    /**
     * 当前分页的页码（从1开始）
     */
    private long current;

    /**
     * 当前请求页的记录条数
     */
    private long pageSize;

    /**
     * 当前满足查询条件的总记录条数
     */
    private long total;

    /**
     * 当前分页的总页数
     */
    private long count;

    private List<T> data;

    public PageResult() {
        this.current = 0;
        this.pageSize = 0;
        this.count = 0;
        this.total = 0;
    }

    public PageResult(long current, long pageSize, long total, long count, List<T> data) {
        this.current = current;
        this.pageSize = pageSize;
        this.total = total;
        this.count = count;
        this.data = data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public void setCurrent(long current) {
        this.current = current;
    }

    public void setPageSize(long pageSize) {
        this.pageSize = pageSize;
    }

    public void setCount(long count) {
        this.count = count;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    @Override
    public String toString() {
        return "SiPageResult{" +
                "current=" + current +
                ", size=" + pageSize +
                ", total=" + total +
                ", pages=" + count +
                ", data=" + data +
                '}';
    }
}
